package wql.aaa.controller;

import com.aaa.entity.TbBanner;
import com.aaa.entity.TbBottomArticle;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import wql.aaa.service.TbBannerService;
import wql.aaa.service.TbBottomArticleService;
import wql.aaa.vo.AddBottomArticle;
import wql.aaa.vo.BannerFormDta;
import wql.aaa.vo.BottomFormData;

/**
 * @author wql
 * @version 1.0
 * @date 2023/2/28 14:57
 */
@RestController
@RequestMapping("/home/bottomArticle")
public class TbBottomArticleController {

    @Autowired
    private TbBottomArticleService tbBottomArticleService;

    @PostMapping("/getAllBottomArticle/{currentPage}/{pageSize}")
    public Result getAll(@PathVariable Integer currentPage,@PathVariable Integer pageSize, @RequestBody(required = false) BottomFormData bottomFormData){
        return tbBottomArticleService.queryAll(currentPage,pageSize,bottomFormData);
    }

    @PostMapping("/deleteBottomArticle/{id}")
    public Result delete( @PathVariable String id){
        return tbBottomArticleService.deleteById(id);
    }

    @PostMapping("/changeStatus/{isDisable}/{id}")
    public Result changeStatus( @PathVariable Integer isDisable, @PathVariable String id){
        return tbBottomArticleService.updateIsDisabled(isDisable,id);
    }

    @PostMapping("/editBottomArticle")
    public Result update(@RequestBody TbBottomArticle tbBottomArticle){
        return tbBottomArticleService.updateArtical(tbBottomArticle);
    }

    @PostMapping("/addBottomArticle")
    public Result add(@RequestBody AddBottomArticle addBottomArticle){
        return tbBottomArticleService.add(addBottomArticle);
    }

}
